<!-- Header -->
<div class="header bg-primary pb-6">
  <div class="container-fluid">
    <div class="header-body">
      
      <!-- Card stats -->
      <div class="row">
        <div class="col mt-4">
          <div class="card">
            <!-- Card header -->
            <div class="card-header">
              <!-- Title -->
              <h5 class="h3 mb-0">必看公告</h5>
            </div>
            <!-- Card image -->
            <!-- List group -->
            <!-- Card body -->
            <div class="card-body">
              {{.setting.user_page_html}}
            </div>
          </div>
        </div>
        
      </div>
    </div>
  </div>
</div>

<div class="container-fluid mt--6">
  <div class="row">
    <div class="col ">
      <div class="card">
        <!-- Card header -->
        <div class="card-header">
          <!-- Title -->
          <h5 class="h3 mb-0">我的订阅信息</h5>
        </div>
        <!-- Card image -->
        <!-- List group -->
        <!-- Card body -->
        <div class="card-body">
          {{if eq .data.Id 0}}
            <a href="/user/plan">请购买订阅</a>
          {{else}}
            <h2>{{.data.Name}} </h2>
            <p class="card-text" id="expired_at_id">到期时间:{{.user.ExpiredAt}}</p>
            <div class="progress">
              <div id="jdt" class="progress-bar bg-success" role="progressbar" style="width: 100%;"></div>
            </div>
            <p class="card-text">已用：{{.total_used_traffic}}GB / 总计：{{.transfer_enable}}GB</p>
            <hr>
            <h3>我的套餐信息：</h3>
            <p class="card-text" id="expired_at_id">价格：{{.data.Price}}</p>
            <p class="card-text" id="expired_at_id">时长：{{.data.Expired}} 天</p>
            <p class="card-text" id="expired_at_id">速度：{{if gt .data.SpeedLimit 0}}{{.data.SpeedLimit}} Mbps{{else}}不限制{{end}}</p>
            <p class="card-text" id="expired_at_id">流量：{{.data.TransferEnable}} GB</p>
            <p>{{if eq .data.Renew 1}}<button type="button" onclick="xf({{.data.Id}})" class="btn btn-outline-success">续费</button>{{else}}<button type="button" class="btn btn-outline-default">不允许续费</button>{{end}}</p>
          {{end}}
          
        </div>
      </div>
    </div>
  </div>
</div>


{{if ne .data.Id 0}}
<div class="container-fluid ">
  <div class="row">
  <div class="col">
    <div class="card">
      <!-- Card header -->
      <div class="card-header border-0">
        <h3 class="mb-0">订阅地址</h3>
      </div>
      <!-- Light table -->
      <div class="table-responsive">
        <table class="table align-items-center table-flush">
          <thead class="thead-light">
            <tr>
              <th scope="col">软件</th>
              <th scope="col">地址</th>
              <th scope="col"></th>
            </tr>
          </thead>
          <tbody class="list">
            <tr>
              <th scope="row">
                <div class="media align-items-center">
                  <a href="#" class="avatar rounded-circle mr-3">
                    <img alt="Image placeholder" src="/resource/image/theme/v2rayN.ico">
                  </a>
                  <div class="media-body">
                    <span class="name mb-0 text-sm">v2rayN</span>
                  </div>
                </div>
              </th>
              <td class="budget">
                {{.setting.subscribe_domain}}api/subscribe?token={{.user.Token}}&flag=1
              </td>
              
              <td class="text-right" style="cursor: pointer;" onclick="myFunction('{{.setting.subscribe_domain}}api/subscribe?token={{.user.Token}}&flag=1')">
                复制
              </td>
            </tr>

            <tr>
              <th scope="row">
                <div class="media align-items-center">
                  <a href="#" class="avatar rounded-circle mr-3">
                    <img alt="Image placeholder" src="/resource/image/theme/v2rayNG.png">
                  </a>
                  <div class="media-body">
                    <span class="name mb-0 text-sm">v2rayNG</span>
                  </div>
                </div>
              </th>
              <td class="budget">
                {{.setting.subscribe_domain}}api/subscribe?token={{.user.Token}}&flag=2
              </td>
              
              <td class="text-right" style="cursor: pointer;" onclick="myFunction('{{.setting.subscribe_domain}}api/subscribe?token={{.user.Token}}&flag=2')">
                复制
              </td>
            </tr>

            <tr>
              <th scope="row">
                <div class="media align-items-center">
                  <a href="#" class="avatar rounded-circle mr-3">
                    <img alt="Image placeholder" src="/resource/image/theme/shadowrocket.png">
                  </a>
                  <div class="media-body">
                    <span class="name mb-0 text-sm">shadowrocket</span>
                  </div>
                </div>
              </th>
              <td class="budget">
                {{.setting.subscribe_domain}}api/subscribe?token={{.user.Token}}&flag=3
              </td>
              
              <td class="text-right" style="cursor: pointer;" onclick="myFunction('{{.setting.subscribe_domain}}api/subscribe?token={{.user.Token}}&flag=3')">
                复制
              </td>
            </tr>

            <tr>
              <th scope="row">
                <div class="media align-items-center">
                  <a href="#" class="avatar rounded-circle mr-3">
                    <img alt="Image placeholder" src="/resource/image/theme/clash.png">
                  </a>
                  <div class="media-body">
                    <span class="name mb-0 text-sm">clash</span>
                  </div>
                </div>
              </th>
              <td class="budget">
                {{.setting.subscribe_domain}}api/subscribe?token={{.user.Token}}&flag=4
              </td>
              
              <td class="text-right" style="cursor: pointer;" >
                <a href="clash://install-config?url={{.setting.subscribe_domain | url}}{{"api/subscribe?token=" | url}}{{.user.Token}}{{"&flag=4" | url}}">导入</a>
              </td>
            </tr>

            <tr>
              <th scope="row">
                <div class="media align-items-center">
                  <a href="#" class="avatar rounded-circle mr-3">
                    <img alt="Image placeholder" src="/resource/image/theme/shadowsocks.png">
                  </a>
                  <div class="media-body">
                    <span class="name mb-0 text-sm">shadowsocks</span>
                  </div>
                </div>
              </th>
              <td class="budget">
                {{.setting.subscribe_domain}}api/subscribe?token={{.user.Token}}&flag=5
              </td>
              
              <td class="text-right" style="cursor: pointer;" onclick="myFunction('{{.setting.subscribe_domain}}api/subscribe?token={{.user.Token}}&flag=5')">
                复制
              </td>
            </tr>
            
            
          </tbody>
        </table>
      </div>
     
    </div>
  </div>
</div>
</div>
{{end}}